<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
  <meta charset="UTF-8">
  <title>点单详情页</title>
  <meta name="page-view-size" content="1280*720">
  <link rel="stylesheet" href="../css/base.css">
  <link rel="stylesheet" href="../css/orderDetail.css">
  <script type="text/javascript" src="../lib/js/evm.js"></script>
  <script type="text/javascript" src="../lib/js/Evm_djyw.js"></script>
  <script type="text/javascript" src="../lib/js/key.js"></script>
  <script src="../lib/js/jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script>
  <script src="../lib/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/api.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/public.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/video.js"></script>
  <style>
  </style>
</head>

<body>
  <!-- <marquee behavior="" direction="">欢迎您进入金湖县新时代文明实践中心！</marquee> -->
  <div class="articleDetail-bg" id="articleDetailMain">

    <div id="articleDetailBody">
      <!-- <div class="title"></div> -->
      <!-- <div class="time"></div> -->
      <!-- <div class="author"></div>
            <div class="view"></div>
            <div class="likeNumber"></div> -->
      <!-- 左边区域 -->
      <div class="left-border">
        <div class='lefttitle'></div>
        <div class="left-content">阿斯达四大撒大撒多</div>
        <div class="left-time"></div>
        <div class="leftimg-border"><img class="shareimg" src="" alt=""></div>
        <div class="left-label">扫码点单</div>
      </div>
      <div class="model" id="left-button">

        <div class="icon-button">点单</div>
        <!-- <div class='confirm'>确定</div> -->
      </div>
      <div class="model" id="detailContain">
        <div class="container" id="detail">
          往期点单：
          <div class="content" id="content">
          </div>
        </div>
        <!-- <div class="join" id="join">报名</div> -->
      </div>
      <!-- <div class="model" id="like">
              点赞
            </div> -->
      <!-- <div class="model" id='collection'>
              收藏
            </div> -->
      <!-- <div class="share">
              扫码分享
            </div> -->
      <div class="detailMsg">

      </div>
    </div>
</body>
<script>
  var modelIndex = {
    disUser: true,
    //isVideo: true,
    index: 0, //初始位置
    listName: 'model', //模块名称
    containerId: 'articleDetailBody', //包含模块的标签id
    thisContain: 'detailContain', //翻滚外容器
    thisDetail: 'detail', //翻滚内容
  }

  var articleRun;
  var photos;
  var cur_period;

  function direOpt(index, directive) {
    // if (directive == "up") {//上
    //     if (index == 1) {//文章翻滚
    //         TV.articleMove(directive, modelIndex.thisContain, modelIndex.thisDetail);
    //     }else if(index == 2 || index == 3) {
    //         index = 0;
    //     }
    // } else if (directive == "down") {//下
    //     if (index == 1) {//文章翻滚
    //         TV.articleMove(directive, modelIndex.thisContain, modelIndex.thisDetail);
    //     }else if(index == 0) {
    //         index = 2;
    //     }
    // } else if(directive == 'forwards') {
    //     if(index == 0){
    //       index = 1
    //     }else if(index == 1 ){
    //       index  ++
    //     }
    //     clearInterval(articleRun);
    // } else if(directive == 'backwards'){
    //   if(index == 1){
    //     index = 0
    //   }else if (index == 2 || index == 3){
    //     index --;
    //   }
    //   clearInterval(articleRun);
    // }
    return index;
  }

  function getMessage() {
    var param = {
      page: 1,
      pagesize: 8,
      order_id: TV.GetParam('id')
    }
    GetDatas('orderDetail', param, function (err, res) {
      var mess = res.data;
      // console.log(mess.orderlog,11111111)
      cur_period = mess.order.cur_period;
      $('.lefttitle').html(mess.order.title);
      $('.left-content').html(mess.order.content);
      $('.left-time').html(mess.order.start_time + '至' + mess.order.end_time.slice(5));
      var surl = API_URL.loginURL + "home/index/qrcode?url=" + encodeURIComponent(API_URL.WXActivityUrlDetail +"/"+ TV.GetParam(
        'id'));
      $('.shareimg').attr('src', surl);
      // 
      var str = '';
      if (mess.orderlog.length > 0) {

        for (var i = 0; i < mess.orderlog.slice(0, 7).length; i++) {
          str += '<div class="list-order">' + mess.orderlog[i].start_time + '--' + mess.orderlog[i].end_time;
          str += '<span>' + mess.orderlog[i].counts + '次</span>'
          str += '</div>'


        }
      } else {
        str += '<h1>暂无数据</h1>';
      }
      $('.content').html(str);
      
    })
  }
  getMessage();

  function direEnter(index) {
    var access_token = $.cookie('TV_CST_TOKEN');
    if (index == 0) {

      var param = {
        period_id: cur_period,
        token: access_token,
      }
      // console.log(param)
      GetDatas('orderSure', param, function (err, res) {
        console.log(res)
        if (res.code == 0) {
          TV.PromptMsg('点单成功')
        } else if (res.code == 401) {
          var message = res.message
          TV.PromptMsg(message)
          setTimeout(function(){
            window.location.href = './login.html';
          },2500)
        } else {
          var message = res.message
          TV.PromptMsg(message)
        }
      })
    }
    // if (index == 0 && photos && photos.length) {
    //   window.location.href = './carrousel.html?id=' + TV.GetParam('id');
    // } else if (index == 1) {
    //   var access_token = $.cookie('TV_CST_TOKEN');
    //   var param = {
    //     id: TV.GetParam('id'),
    //     access_token: access_token,
    //   }
    //   GetDatas('join', param, function (err, res) {
    //     console.log(res)
    //     if (res.code == 0) {
    //       TV.PromptMsg('报名成功')
    //       $(".cur-number").eq(index).html(res.data.likes);
    //       // $('#like').css('background-image','url(../images/like-2.png)')
    //     } else if (res.code == 10009) {

    //       TV.userLogin();
    //       direEnter(index);
    //       // alert('111')
    //     } else {
    //       var message = res.message
    //       TV.PromptMsg(message)
    //     }
    //   })
    // } else if (index == 2) {
    //   var access_token = $.cookie('TV_CST_TOKEN');
    //   var param = {
    //     id: TV.GetParam('id'),
    //     access_token: access_token,
    //   }
    //   GetDatas('activityLike', param, function (err, res) {
    //     console.log(res)
    //     if (res.code == 0) {
    //       TV.PromptMsg('点赞成功')
    //       $(".cur-number").eq(index).html(res.data.likes);
    //       $('#like').css('background-image', 'url(../images/like-2.png)')
    //     } else if (res.code == 10009) {

    //       TV.userLogin();
    //       direEnter(index);
    //       // alert('111')
    //     } else {
    //       var message = res.message
    //       TV.PromptMsg(message)
    //     }
    //   })
    // }
  }
</script>
<script type="text/javascript" src="../js/index.js"></script>

</html>